<?php
require_once(__DIR__.'/../core/globalFunctions.php');
require_once(__DIR__.'/../core/eventSubscriber.php');

// This is the main module. It is responsible for calling major events in page construction. 
class Main extends EventSubscriber {
	function __construct ($name) {
		// Define events that the module is interested in.
		$this->subscriptions = array("main"/*, "pageBody","pageFoot"*/);
		$this->title = "Test";
		parent::__construct($name);
	}

	function handleEventCallback ($event) {
		// Define responses to event callbacks.
		switch ($event) {
			case "main":
				echo "<!DOCTYPE html>\n<html>\n<head>\n";
				event("head");
				echo "</head>\n<body>";
				if (getUser()->loggedIn()) {
					echo "logged in";
				}
				event("body");
				echo "</body>\n</html>";
				break;
		}
	}
}
?>